var app, ns;
app = new Vue({
    el: '#app',
    data: {},
    methods: {
        get_data: function() {
            var that = this;
            that.open_home_index();
            setTimeout(function() {
                that.open_intro_index();
            }, 2000);
        },
        open_home_index: function() {
            var delay = 0;
            if (api.systemType != 'ios') {
                delay = 100;
            }
            api.openFrame({
                name: 'main_home_index',
                url: 'home_index.html',
                delay: delay,
                slidBackEnabled: false,
                vScrollBarEnabled: false,
                rect: {
                    x: 0,
                    y: 0,
                    w: 'auto',
                    h: 'auto'
                }
            });
        },
        open_intro_index: function() {
            var delay = 0;
            if (api.systemType != 'ios') {
                delay = 100;
            }
            api.openWin({
                name: 'intro_index',
                url: 'intro_index.html',
                delay: delay,
                slidBackEnabled: false,
                vScrollBarEnabled: false,
                rect: {
                    x: 0,
                    y: 0,
                    w: 'auto',
                    h: 'auto'
                }
            });
        },
        set_status_bar: function() {
            api.setStatusBarStyle({
                style: 'dark',
                color: 'transparent'
            });
        }
    }
});
apiready = function() {
    app.set_status_bar();
    api.parseTapmode();
    ns = window.Foresight.Util;
    app.get_data();
    var last_out_time;
    api.addEventListener({
        name: 'keyback'
    }, function(ret, err) {
        if (last_out_time && last_out_time.valueOf() >= (new Date().valueOf() - 1000)) {
            api.closeWidget({
                silent: true
            });
            return;
        }
        last_out_time = new Date();
        api.toast({
            msg: '再按一次退出程序',
            duration: 1000
        });
    });
};
